rem 创建输出目录
if not exist .\lib mkdir .\lib
if not exist .\lib\x64 mkdir .\lib\x64
if not exist .\lib\Win32 mkdir .\lib\Win32
if not exist .\lib\x64\Debug mkdir .\lib\x64\Debug
if not exist .\lib\x64\Release mkdir .\lib\x64\Release
if not exist .\lib\Win32\Debug mkdir .\lib\Win32\Debug
if not exist .\lib\Win32\Release mkdir .\lib\Win32\Release
if not exist ..\include mkdir ..\include

echo "win32 Release"
if not exist "mysql-connector-c++-8.0.33-win32" (
    mkdir "mysql-connector-c++-8.0.33-win32"
)
cd "mysql-connector-c++-8.0.33-win32"
if not exist ..\mysql-connector-c++-8.0.33-win32.zip (
    curl "https://cdn.mysql.com/archives/mysql-connector-c++/mysql-connector-c++-8.0.33-win32.zip" -o ..\mysql-connector-c++-8.0.33-win32.zip
    PowerShell -Command "Expand-Archive ..\mysql-connector-c++-8.0.33-win32.zip ."
)
cd "mysql-connector-c++-8.0.33-win32"
robocopy .\include\jdbc ..\..\include\jdbc /E /COPYALL /R:1 /W:1 /NFL /NDL
robocopy .\include\mysql ..\..\include\mysql /E /COPYALL /R:1 /W:1 /NFL /NDL
robocopy .\include\mysqlx ..\..\include\mysqlx /E /COPYALL /R:1 /W:1 /NFL /NDL
copy ".\lib\vs14\libcrypto.lib" ..\..\lib\Win32\Release
copy ".\lib\vs14\libssl.lib" ..\..\lib\Win32\Release
copy ".\lib\vs14\mysqlcppconn.lib" ..\..\lib\Win32\Release
copy ".\lib\libcrypto-1_1.dll" ..\..\lib\Win32\Release
copy ".\lib\libssl-1_1.dll" ..\..\lib\Win32\Release
copy ".\lib\mysqlcppconn-9-vs14.dll" ..\..\lib\Win32\Release
copy ".\lib\mysqlcppconn8-2-vs14.dll" ..\..\lib\Win32\Release
cd ..\..

echo "winx64 Release"
if not exist "mysql-connector-c++-8.0.33-winx64" (
    mkdir "mysql-connector-c++-8.0.33-winx64"
)
cd "mysql-connector-c++-8.0.33-winx64"
if not exist ..\mysql-connector-c++-8.0.33-winx64.zip (
    curl "https://cdn.mysql.com/archives/mysql-connector-c++/mysql-connector-c++-8.0.33-winx64.zip" -o ..\mysql-connector-c++-8.0.33-winx64.zip
    PowerShell -Command "Expand-Archive ..\mysql-connector-c++-8.0.33-winx64.zip ."
)
cd "mysql-connector-c++-8.0.33-winx64"
copy ".\lib64\vs14\libcrypto.lib" ..\..\lib\x64\Release
copy ".\lib64\vs14\libssl.lib" ..\..\lib\x64\Release
copy ".\lib64\vs14\mysqlcppconn.lib" ..\..\lib\x64\Release
copy ".\lib64\libcrypto-1_1-x64.dll" ..\..\lib\x64\Release
copy ".\lib64\libssl-1_1-x64.dll" ..\..\lib\x64\Release
copy ".\lib64\mysqlcppconn-9-vs14.dll" ..\..\lib\x64\Release
copy ".\lib64\mysqlcppconn8-2-vs14.dll" ..\..\lib\x64\Release
cd ..\..

echo "win32 Debug"
if not exist "mysql-connector-c++-8.0.33-win32-debug" (
    mkdir "mysql-connector-c++-8.0.33-win32-debug"
)
cd "mysql-connector-c++-8.0.33-win32-debug"
if not exist ..\mysql-connector-c++-8.0.33-win32-debug.zip (
    curl "https://cdn.mysql.com/archives/mysql-connector-c++/mysql-connector-c++-8.0.33-win32-debug.zip" -o ..\mysql-connector-c++-8.0.33-win32-debug.zip
    PowerShell -Command "Expand-Archive ..\mysql-connector-c++-8.0.33-win32-debug.zip ."
)
cd "mysql-connector-c++-8.0.33-win32"
copy ".\lib\vs14\libcrypto.lib" ..\..\lib\Win32\Debug
copy ".\lib\vs14\libssl.lib" ..\..\lib\Win32\Debug
copy ".\lib\vs14\debug\mysqlcppconn.lib" ..\..\lib\Win32\Debug
copy ".\lib\libcrypto-1_1.dll" ..\..\lib\Win32\Debug
copy ".\lib\libssl-1_1.dll" ..\..\lib\Win32\Debug
copy ".\lib\debug\mysqlcppconn-9-vs14.dll" ..\..\lib\Win32\Debug
copy ".\lib\debug\mysqlcppconn8-2-vs14.dll" ..\..\lib\Win32\Debug
cd ..\..

echo "winx64 Debug"
if not exist "mysql-connector-c++-8.0.33-winx64-debug" (
    mkdir "mysql-connector-c++-8.0.33-winx64-debug"
)
cd "mysql-connector-c++-8.0.33-winx64-debug"
if not exist ..\mysql-connector-c++-8.0.33-winx64-debug.zip (
    curl "https://cdn.mysql.com/archives/mysql-connector-c++/mysql-connector-c++-8.0.33-winx64-debug.zip" -o ..\mysql-connector-c++-8.0.33-winx64-debug.zip
    PowerShell -Command "Expand-Archive ..\mysql-connector-c++-8.0.33-winx64-debug.zip ."
)
cd "mysql-connector-c++-8.0.33-winx64"
cd "mysql-connector-c++-8.0.33-winx64"
copy ".\lib64\vs14\libcrypto.lib" ..\..\lib\x64\Debug
copy ".\lib64\vs14\libssl.lib" ..\..\lib\x64\Debug
copy ".\lib64\vs14\debug\mysqlcppconn.lib" ..\..\lib\x64\Debug
copy ".\lib64\libcrypto-1_1-x64.dll" ..\..\lib\x64\Debug
copy ".\lib64\libssl-1_1-x64.dll" ..\..\lib\x64\Debug
copy ".\lib64\debug\mysqlcppconn-9-vs14.dll" ..\..\lib\x64\Debug
copy ".\lib64\debug\mysqlcppconn8-2-vs14.dll" ..\..\lib\x64\Debug
cd ..\..